import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import {HttpServies} from '../../providers/http-servies';
import 'rxjs/add/operator/toPromise';
import {HomePage} from "../home/home";
/**
 * Generated class for the BalancePage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */


@Component({
  selector: 'page-balance',
  templateUrl: 'balance.html',
  providers:[HttpServies]
})
export class BalancePage {
  userInfo = {
    'balance': '',
  }
  constructor(public navCtrl: NavController, public navParams: NavParams,private http:HttpServies) {
  }

  checkInfo(){
    var param = "balance=" + this.userInfo.balance;
    this.http.httpPost('/home/homepage/balance_into_i', param)
        .then(res => {
          if (res && res.code == 1) {
            this.http.showErro(res.msg);
              this.navCtrl.push(HomePage);
          }else {
            this.http.showErro(res.msg);
          }
        })
  }
}
